package shape3D;     

import javafx.application.Application;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.SceneAntialiasing;
import javafx.scene.SubScene;
import javafx.stage.Stage;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.*;

// 子场景(根面板中的2D图形不会遮挡子场景面板中的的3D效果)
public class SubSceneDemo extends Application { 
	private HBox root = new HBox();
	private Rectangle rectangle;
	private SubScene ss;		// 子场景(结点,而Scene非结点)
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		rectangle = new Rectangle(100, 100, Color.ORANGE);
		Cylinder cylinder = new Cylinder(50, 150, 5);
		
		StackPane sp = new StackPane(cylinder);
		ss = new SubScene(sp, 300, 300, true, SceneAntialiasing.BALANCED);
		ss.setCamera(new PerspectiveCamera());
		root.getChildren().addAll(rectangle, ss);
		
		Scene scene = new Scene(root, 700, 400, true);	
		scene.setCamera(new PerspectiveCamera());
		stage.setScene(scene);
		stage.show();
	}
}





